package com.xxwy.study.client.code;

import com.xxwy.study.common.ResponseMessage;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;

import java.util.List;

/**
 * 点单协议第二步：byte解析为java对象
 *
 * @author xxwy
 * @date 2021/11/23 0023
 */
public class OrderProtocolDecoder extends MessageToMessageDecoder<ByteBuf> {

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
        ResponseMessage requestMessage = new ResponseMessage();
        requestMessage.decode(msg);
        out.add(requestMessage);
    }
}
